package io;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class PWDemo2 {
    public static void main(String[] args) throws FileNotFoundException {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream("pw.txt"), StandardCharsets.UTF_8)),true);
        while (true){
            String line = sc.nextLine();
            if ("exit".equalsIgnoreCase(line)){
                break;
            }
            pw.write(line);
        }
        pw.close();

    }
}
